/* -*- mode: C++; tab-width:4; c-basic-offset: 4; indent-tabs-mode:nil -*- */
/************************************************************************
 *
 *  File: MatOperations.hpp
 *
 *  Created: 2009-08-13
 *
 *  Version:
 *
 *  Authors: Christopher Dyken <christopher.dyken@sintef.no>
 *
 *  This file is part of the siut library.
 *  Copyright (C) 2009 by SINTEF.  All rights reserved.
 *
 *  SINTEF, Pb 124 Blindern, N-0314 Oslo, Norway
 *  http://www.sintef.no
 *********************************************************************/

#ifndef _SIUT_SIMD_MATOPERATIONS_HPP_H_
#define _SIUT_SIMD_MATOPERATIONS_HPP_H_

#include "siut/simd/Mat4f.hpp"

namespace siut {
    namespace simd {


/** Creates a new matrix from a set of entries in row-major order
 *
 * The constructor of Mat4f takes entries in column-major order (for
 * glsl compatibility), but this makes the entries appear visually
 * transposed in the source code. 
 *
 */
inline Mat4f
matrixFromRowMajorEntriesf( float m00, float m01, float m02, float m03,
                            float m10, float m11, float m12, float m13,
                            float m20, float m21, float m22, float m23,
                            float m30, float m31, float m32, float m33 )
{
  Mat4f R;

  R.v_[0 ] = m00;
  R.v_[1 ] = m10;
  R.v_[2 ] = m20;
  R.v_[3 ] = m30;
  
  R.v_[4 ] = m01;
  R.v_[5 ] = m11;
  R.v_[6 ] = m21;
  R.v_[7 ] = m31;
  
  R.v_[8 ] = m02;
  R.v_[9 ] = m12;
  R.v_[10] = m22;
  R.v_[11] = m32;
  
  R.v_[12] = m03;
  R.v_[13] = m13;
  R.v_[14] = m23;
  R.v_[15] = m33;  

  return R;
}

    } // of namespace simd
} // of namepsace siut
#endif // _SIUT_SIMD_MATOPERATIONS_HPP_H
